﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>驰骋工作流</title>
    <!-- 引用通用的js文件. -->
    <script src="../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../Scripts/config.js" type="text/javascript"></script>
    <script src="Gener.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript" >

        //定义公共个变量.
        var webUser = new WebUser();

        //页面启动函数.
        $(function () {

            if (webUser.No == undefined) {
                alert('登录信息丢失，请重新登录。');
                return;
            }

            var ensName = GetQueryString("EnsName");

            if (ensName == null || ensName == undefined) {
                $("#Msg").html("必要的参数EnsName没有传入.");
                return;
            }

            $("#Msg").html("<img src=../Img/loading.gif />&nbsp;正在加载,请稍后......");

            //初始化工具栏.
            InitToolbar();

            //绑定数据.
            BindTree();

            $("#Msg").html("");
        });

        function InitToolbar() {

            //创建处理器.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
            handler.AddUrlData();  //增加参数.
            //获得map基本信息.
            mapBase = handler.DoMethodReturnJSON("Search_MapBaseInfo");

            document.title = mapBase.EnDesc;
           
           //获得权限, 生成toolbar.
           var IsUpdata = uac.IsUpdate;

            /*
            ht.Add("IsUpdata", uac.IsUpdate);
            ht.Add("IsInsert", uac.IsInsert);
            ht.Add("IsDelete", uac.IsDelete);
            ht.Add("IsView", uac.IsView);
            ht.Add("IsExp", uac.IsExp); //是否可以导出?
            ht.Add("IsImp", uac.IsImp); //是否可以导入? */
       }

       function BindTree() {

           //创建处理器.
           var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
           handler.AddUrlData();  //增加参数.
           //获得map基本信息.
           var treeJson = handler.DoMethodReturnJSON("Tree_Init");
           //绑定树结构.
       }

       function Del(no, name) {

           if (confirm('您确认要删除[' + name + ']吗？') == false)
               return;

           var enName = GetEnName();
           var en = new Entity(enName, no);

           try {

               en.Delete();

               //需要从节点上去掉.

           } catch (e) {
               alert(e);
           }
       }

       //创建下级节点.
       function DoMyCreateSubNode(no) {

           var enName = GetEnName();
           var en = new Entity(enName, no);
           var treeEn = en.DoMethodReturnString("DoMyCreateSubNode");

           var no = treeEn.No;
           var name = treeEn.Name;
           var parentNo = treeEn.ParentNo;

           //把节点绑定到树上. todo
       }

       //创建同级节点.
       function DoMyCreateSubNode(no) {

           var enName = GetEnName();
           var en = new Entity(enName, no);
           var treeEn = en.DoMethodReturnString("DoMyCreateSameLevelNode");

           var no = treeEn.No;
           var name = treeEn.Name;
           var parentNo = treeEn.ParentNo;

           //把节点绑定到树上. todo

       }

       function DoUp(no) {
           var enName = GetEnName();
           var en = new Entity(enName, no);
           en.DoMethodReturnString("DoUp");
           // 执行节点移动.

       }
       function DoDown(no) {
           var enName = GetEnName();
           var en = new Entity(enName, no);
           en.DoMethodReturnString("DoDown");
           // 执行节点移动.
       }

       function Edit(no) {
           var url = "En.htm?EnName=" + GetEnName() + "&No=" + no;
           WinOpen(url);
       }
        
       //获得enName.
       function GetEnName() {

           var ensName = GetQueryString("EnsName");
           return ensName.substring(0, ensName.length - 1);
       }
    </script>
</head>
<body  >

<form id="cc">

<br />
<center> <img src='../Img/loading.gif' />正在加载，请稍后。。。 </center>


</form>

</body>
</html>
